<!DOCTYPE html>
<html lang="zh-CN">

<head>
	<meta charset="UTF-8" />
	<meta name="author" content="wangbo" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<title>函数嵌套</title>
</head>

<body>
	<script type="text/javascript">
		function jisuanji() {
			var num1 = prompt('输入第一个数字');
			var st = prompt('输入加减乘除符号');
			var num2 = prompt('输入第二个数字');
			function getNum(num1, num2) {
				return [parseInt(num1) + parseInt(num2), num1 - num2, num1 * num2, num1 / num2];
			}
			var str = getNum(num1, num2);
			if (st == '+') {
				alert(str[0]);
			} else if (st == '-') {
				alert(str[1]);
			} else if (st == '*') {
				alert(str[2]);
			} else if (st == '/') {
				alert(atr[3]);
			}
		}
		jisuanji()

	</script>
</body>

</html>